{template 'header'}
<style>
.lists{
	width:100%;
	height:auto;
}
.l-item{
	width:100%;
	text-align:center;
	display:flex;
	display: -webkit-flex;
	height:40px;
	line-height:40px;
	border-bottom:1px solide #eee;
	border-bottom: 1px solid #eee;
}
.l-item .l-left{
	width:30%;
	color:#333;
}
.l-item .l-center{
	width:25%;
	color:#01bb94;
}
.l-item .l-right{
	width:45%;
	color:#333;
}
</style>
<div class="lists" id="lists">
	<div class="l-item">
		<div class="l-left">备注</div>
		<div class="l-center">金额</div>
		<div class="l-right">时间</div>
	</div>

</div>
<div style="height:60px;width:100%;"></div>
{template 'loading'}
{template 'footer'}
<script>
$(function(){
	getList();
});

var page = 1;
//下拉加载
var range = -80; //距下边界长度/单位px
var totalheight = 0;
var loading = false;
$(window).scroll(function(){
	if(loading) return false;
  var srollPos = $(window).scrollTop(); //滚动条距顶部距离(页面超出窗口的高度)
  totalheight = parseFloat($('body').height()) + parseFloat(srollPos);
  if(($("body").height()-range) <= totalheight) {
  	if(loading) return false;
  	page++;
  	getList();
  }            
});
function getList(){
	if(loading) return false;
	loading = true;
	LOADING(true)
	$.ajax({
		url: "{php echo $this->createMobileUrl('getmcreditlist',array('mid'=>$mem['id']))}",
		data: {page:page,scroll:true},
		type: "post",
		success: function(dat){
			LOADING(false)
			dat = JSON.parse(dat);
			console.log(dat)
			if(dat.status==1){
				dat = dat.lists;
				var str = '';
				for(var i in dat){
					str += '<div class="l-item">';
					str += '<div class="l-left">'+dat[i].remark+'</div>';
					str += '<div class="l-center">'+dat[i].credit+'</div>';
					str += '<div class="l-right">'+dat[i].createtime+'</div>';
					str += '</div>';
				}
				$('#lists').append(str);
				loading = false;
			}
			else{
				loading = true;
			}
		}	
	});	
}
</script>

</body>
</html>